package com.huawei.appgallery.forum.forum.activity;

import android.app.ActionBar;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.forum.base.ui.ForumActivity;
import com.huawei.appgallery.forum.forum.api.IForumDetailProtocol;
import com.huawei.hmf.annotation.ActivityDefine;
import o.azb;
import o.bqx;
import o.bun.a;
import o.bun.c;
import o.bun.d;
import o.bzx;
import o.cgv;
import o.evx;
import o.fho;
import o.fiu;
import o.fiv;
import o.fjb;
import o.fjm;
import o.FragmentTransaction;

@ActivityDefine(alias = "forum.detail", protocol = IForumActivityProtocol.class)
public class ForumDetailActivity extends ForumActivity {
    private fiv ˋॱ = fiv.ॱ(this);
    protected String ͺ;
    private IForumActivityProtocol ॱˊ;
    private TextView ॱˋ;

    public void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        setContentView(d.ॱ);
        getWindow().getDecorView().setBackgroundColor(getResources().getColor(a.ॱ));
        cgv.ˋ(this, a.ˊ, a.ॱ);
        if (ᐝ()) {
            ͺ();
            ˊ(bundle);
            return;
        }
        finish();
    }

    private boolean ᐝ() {
        this.ॱˊ = (IForumActivityProtocol) this.ˋॱ.ॱ();
        if (this.ॱˊ != null) {
            this.ͺ = this.ॱˊ.getUri();
        }
        if (!TextUtils.isEmpty(this.ͺ)) {
            return true;
        }
        bqx.ॱ("ForumDetailActivity", "Arguments error, uri is null");
        return false;
    }

    private void ͺ() {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        View findViewById = findViewById(c.ॱˎ);
        azb.ˏ(findViewById);
        ˊ(findViewById);
        this.ॱˋ = (TextView) findViewById.findViewById(c.ᐝˋ);
        if (this.ͺ != null && this.ͺ.contains("forum|group_forums")) {
            ˎ(findViewById);
        }
    }

    public void ˎ(String str) {
        this.ॱˋ.setText(str);
    }

    private void ˊ(View view) {
        view.findViewById(c.ˋˋ).setOnClickListener(new evx(this) {
            final /* synthetic */ ForumDetailActivity ˋ;

            {
                this.ˋ = r1;
            }

            public void ˋ(View view) {
                this.ˋ.onBackPressed();
            }
        });
    }

    private void ˎ(View view) {
        ((ImageView) view.findViewById(c.ˏˎ)).setImageResource(b.ॱ);
        view.findViewById(c.ˍ).setOnClickListener(new evx(this) {
            final /* synthetic */ ForumDetailActivity ˎ;

            {
                this.ˎ = r1;
            }

            public void ˋ(View view) {
                this.ˎ.ॱˊ();
            }
        });
    }

    private void ॱˊ() {
        ((bzx) fho.ˏ().ˋ("ForumSearch").ॱ(bzx.class)).ॱ(this, false);
    }

    protected void ˊ(Bundle bundle) {
        fjb ˎ = fho.ˏ().ˋ("Forum").ˎ("forumDetailFragment");
        ((IForumDetailProtocol) ˎ.ˊ()).setUri(this.ͺ);
        fjm ˏ = fjm.ˏ(fiu.ˊ().ˋ(this, ˎ));
        FragmentTransaction ˊ = ˏॱ().ˊ();
        ˊ.ˏ(c.ʻॱ, ˏ.ˏ(), "forumHome");
        ˊ.ˏ();
    }
}
